library(bdscale)
library(corrplot)
library(cowplot)
library(diagis)
library(estimatr)
library(fastDummies)
library(foreign)
library(ggplot2)
library(glue)
library(gridExtra)
library(haven)
library(plyr)
library(here)
library(Hmisc)
library(jsonlite)
library(labelled)
library(lubridate)
library(magrittr)
library(modelsummary)
library(openxlsx)
library(psych)
library(qualtRics)
library(readr)
library(scales)
library(stargazer)
library(texreg)
library(tidytext)
library(tidyverse)
library(vtable)

# Load data

data_w0 <- as.data.frame(read_sav(here::here("data","SCOTUS_Survey_Baseline.sav")))
data_w1 <- as.data.frame(read_sav(here::here("data","SCOTUS_Survey_Wave1.sav")))
data_w2 <- as.data.frame(read_sav(here::here("data","SCOTUS_Survey_Wave2.sav")))

sx = \(x) suppressWarnings(source(x, print.eval = T))

# recode data
sx(here::here("clean_and_recode.R"))

# run models
sx(here::here("models.R"))

# generate tables
sx(here::here("generate_tables.R"))

# manuscript figures
sx(here::here("plot_setup.R"))

# Figure 1
sx(here::here("figure_1.R"))

# Figure 2
sx(here::here("figure_2.R"))

# Figure 3
sx(here::here("figure_3.R"))

# Figure 4
sx(here::here("figure_4.R"))

# Figure 5
sx(here::here("figure_5.R"))

# explore heterogeneity
sx(here::here("heterogeneity.R"))

# reviewer requested robustness
sx(here::here("robustness.R"))
